package com.zby.zbyliving.commodity.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.zby.common.validator.EnumValidate;
import com.zby.common.validator.SaveGroup;
import com.zby.common.validator.UpdateGroup;
import com.zby.common.validator.UpdateIsShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 家居品牌
 *
 * @author zby
 * @email 2069189112@qq.com
 * @date 2023-07-22 22:23:10
 */
@Data
@TableName("commodity_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@TableId
	@NotNull(message = "修改要求指定id", groups = {UpdateGroup.class, UpdateIsShowGroup.class})
	@Null(message = "添加不能指定id", groups = {SaveGroup.class})
	private Long id;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空",groups = {SaveGroup.class})
	private String name;
	/**
	 * logo
	 */
	@NotBlank(message = "logo不能为空",groups = {SaveGroup.class})
	@URL(message = "logo 不是一个合法的 url",groups = {SaveGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 说明
	 */
	private String description;
	/**
	 * 显示
	 */
	@NotNull(message = "显示状态不能为空", groups = {SaveGroup.class, UpdateGroup.class, UpdateIsShowGroup.class})
	@EnumValidate(values = {0, 1}, message = "显示状态的值需要是0或者1~", groups = {SaveGroup.class, UpdateGroup.class, UpdateIsShowGroup.class})
	private Integer isshow;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母不能为空", groups = {SaveGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是a-z或者A-Z", groups = {SaveGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序值不能为空", groups = {SaveGroup.class})
	@Min(value = 0, message = "排序值要求大于等于0", groups = {SaveGroup.class, UpdateGroup.class})
	private Integer sort;

}
